<style>
    .layui-fluid {
        padding: 0 10px 0 20px;
    }

    .share1 > div {
        width: 100%;
    }

    .share2 > div {
        width: calc((100% - 20px) / 2);
    }

    .share3 > div {
        width: calc((100% - 40px) / 3);
    }

    .share4 > div {
        width: calc((100% - 60px) / 4);
    }

    .share5 > div {
        width: calc((100% - 80px) / 5);
    }

    .share6 > div {
        width: calc((100% - 100px) / 6);
    }

    .getNewInventoryReportMainBox {
        width: calc(100% - 3px);
        /*height: 100%;*/
        height: calc(100% - 75px);
        overflow-y: scroll;
        overflow-x: hidden;
        padding-right: 5px;

    }

    /*头部导航栏*/
    .report-nav-box {
        width: 100%;
        background: #FFFFFF;
        border-radius: 5px 5px 5px 5px;
        height: 61px;
        position: relative;
        margin-bottom: 20px;
        z-index: 9999;
        box-shadow: 0 20px 0 0 #F0F2F5;
    }

    .report-nav {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
    }

    .report-nav .report-nav-item {
        padding: 10px;
        margin: 0 35px;
        font-size: 16px;
        font-family: Microsoft YaHei-Regular, Microsoft YaHei;
        font-weight: 400;
        color: #999999;
        -webkit-background-clip: text;
        cursor: pointer;
        transition: all 300ms;
    }

    .report-nav .report-nav-item.active,
    .report-nav .report-nav-item:hover {
        font-family: Microsoft YaHei-Bold, Microsoft YaHei;
        font-weight: bold;
        color: #333333;
    }

    .report-nav-bar {
        width: 0;
        height: 6px;
        background: #009C5E;
        position: absolute;
        left: -100px;
        bottom: 0;
        transition: all 500ms;
        transform: translateX(-50%);
    }

    /*报表区域*/
    .report {
        width: 100%;
        /*height: calc(100% - 81px);*/
        /*overflow: hidden;*/
    }

    .report-body {
        width: 100%;
    }

    .report-body-list {
        display: none;
    }

    .report-body-list:first-child {
        display: block;
    }

    .report-main {
        width: 100%;
    }

    .report-main .layui-input {
        background-color: #F5F6FA;
        border-color: transparent;
    }

    .report-main .layui-form-select .layui-edge {
        border-top-color: #00C573;
    }

    .report-main-box {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .report-main-item {
        /*flex: 1;*/
        background-color: #ffffff;
        height: 460px;
        margin-right: 20px;
        margin-bottom: 20px;
        padding: 10px;
        transition: all 1000ms;
        box-sizing: border-box;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .report-main-box > div:last-child {
        margin-right: 0;
    }

    .report-main-item .report-item-header {
        display: flex;
        justify-content: space-between;
        height: 38px;
        align-items: center;
        margin-bottom: 10px;
    }

    .report-item-header .report-item-headerTitle {
        font-size: 20px;
        font-weight: bold;
        color: #333333;
        line-height: 23px;
        margin-right: auto;
    }

    .report-item-header .report-item-headerSelect {
        width: 110px;
        background: #F5F6FA;
        border-radius: 5px 5px 5px 5px;
        box-sizing: border-box;
        margin-right: 15px;
    }

    .report-item-header .report-item-headerSwitch {
        width: 106px;
        height: 24px;
        background: #9AAEBB;
        border-radius: 16px 16px 16px 16px;
        box-sizing: border-box;
        padding: 2px;
        display: flex;
        margin-right: 15px;
    }

    .report-item-headerSwitch .report-item-headerSwitchItem {
        width: 51px;
        height: 20px;
        font-size: 12px;
        font-weight: 400;
        color: #fff;
        text-align: center;
        line-height: 20px;
        background-color: transparent;
        border-radius: 10px;
        cursor: pointer;
        transition: all 300ms;
    }

    .report-item-headerSwitch .report-item-headerSwitchItem.active {
        background-color: #fff;
        color: #9AAEBB;
    }

    .report-item-more {
        margin-left: 30px;
        font-size: 16px;
        font-weight: 400;
        color: #666666;
        cursor: pointer;
        width: 60px;
    }

    .report-main-item .report-item-box {
        flex: 1;
        overflow-y: scroll;
        overflow-x: hidden;
        display: flex;
    }

    .report-item-box .report-itemEcharts {
        width: 100%;
        height: 100%;
        flex: 1;
    }

    .report-timeSelect {
        display: flex;
        box-sizing: border-box;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 20px;
        z-index: 9999;
        background-color: #F0F2F5;
    }

    .report-timeSelect .report-timeSelect-title {
        height: 26px;
        font-size: 20px;
        font-weight: bold;
        color: #333333;
        line-height: 23px;
        position: relative;
        padding: 0 16px;
    }

    .report-timeSelect-title:before {
        content: "";
        display: block;
        height: 100%;
        width: 6px;
        background: #009C5E;
        position: absolute;
        left: 0;
        top: 0;
    }

    .report-timeSelect .report-timeSelect-box {
        display: flex;
    }

    .report-timeSelect-box > div {
        width: 110px;
        height: 48px;
        background: #FFFFFF;
        border-radius: 5px 5px 5px 5px;
        box-sizing: border-box;
        padding: 5px 10px;
        border: 1px solid #EDEFF4;
        margin-left: 10px;
    }

    .report-timeSelect-box .timeFreedom {
        box-sizing: border-box;
        width: 270px;
        height: 48px;
        background: #FFFFFF;
        border-radius: 5px 5px 5px 5px;
        border: 1px solid #EDEFF4;
        padding: 5px 10px;
        line-height: 38px;
        display: flex;
    }

    .timeFreedom .layui-icon {
        font-size: 30px;
        display: none;
    }

    .timeFreedom input {
        width: calc(100% - 30px);
        display: inline-block;
    }

    .report-timeSelect-box > div input {
        border-width: 0;
        font-size: 16px;
        font-weight: 400;
        color: #333333;
        line-height: 19px;
    }

    .report-card {
        display: flex;
        justify-content: space-between;
        margin-bottom: 20px;
    }

    .report-card > .statBoxItemList {
        box-sizing: border-box;
        padding: 28px 20px;
        height: 132px;
        background: #FFFFFF;
        border-radius: 5px 5px 5px 5px;
        display: flex;
        cursor: pointer;
        transition: all 300ms;
    }

    .statBoxItemList > .statBoxItemListContent {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .statBoxItemListContent .statBoxItemListName {
        font-size: 12px;
        font-weight: 400;
        color: #999999;
        line-height: 14px;
        margin-bottom: 10px;
        white-space: nowrap;
    }

    .statBoxItemListContent .statBoxItemListNum {
        font-size: 36px;
        font-weight: bold;
        color: #333333;
        line-height: 42px;
    }

    .statBoxItemListImg {
        width: 70px;
        height: 70px;
        margin-top: 3px;
    }

    .report-table {
        width: 100%;
        min-height: 450px;
        background-color: #FFFFFF;
        overflow: hidden;
        padding: 20px;
        box-sizing: border-box;
    }

    .report-table-title {
        height: 26px;
        font-size: 20px;
        font-weight: bold;
        color: #333333;
        line-height: 23px;
    }

    .report-table-box {
        /*width: 100%;*/
        /*overflow: hidden;*/
    }

    .report-itemEcharts > div:last-child {
        white-space: normal !important;
        word-break: break-word;
        max-width: 45%;
    }

    .statBoxItemListSub {
        display: flex;
        flex: 2;
        margin-left: 20px;
        flex-direction: column;
        justify-content: space-between;
        padding-left: 20px;
        border-left: 1px solid #ECECEC;
        margin-right: 10px;
    }

    .statBoxItemListSub .statBoxItemListSubBox:first-child {
        margin-bottom: 15px;
    }

    .statBoxItemListSub .statBoxItemListSubBox .statBoxItemListName1,
    .statBoxItemListSub .statBoxItemListSubBox .statBoxItemListName2 {
        height: 16px;
        font-size: 12px;
        font-weight: 400;
        color: #999999;
        line-height: 14px;
    }

    .statBoxItemListSub .statBoxItemListSubBox .statBoxItemListNum1,
    .statBoxItemListSub .statBoxItemListSubBox .statBoxItemListNum2 {
        height: 21px;
        font-size: 16px;
        font-weight: bold;
        color: #333333;
        line-height: 19px;
    }

    /*.report-main-item:has(.reportItemCenter){*/
    /*    padding:10px 0 10px 10px;*/
    /*}*/
    .reportItemCenter {
        width: 100%;
        height: auto;
        box-sizing: border-box;
        padding-right: 10px;
    }

    .listBox1 > .listItem1 {
        display: flex;
        align-items: center;
        margin-top: 18px;
    }

    .listItem1 .listItem1Index {
        width: 26px;
        height: 26px;
        background: #F1F2F6;
        border-radius: 50%;
        line-height: 26px;
        text-align: center;
        margin-right: 10px;
        font-size: 14px;
        font-family: Microsoft YaHei-Regular, Microsoft YaHei;
        font-weight: 400;
        color: #666666;
    }

    .listItem1 .listItem1Content {
        flex: 1;
    }

    .listItem1Top {
        display: flex;
        align-items: center;
    }

    .listItem1Name {
        flex: 1;
        font-size: 12px;
        font-family: Roboto-Regular, Roboto;
        font-weight: 400;
        color: #333333;
    }

    .listItem1Value {
        min-width: 60px;
        max-width: 200px;
        margin-right: 10px;
        font-size: 14px;
        font-family: Roboto-Medium, Roboto;
        font-weight: 500;
        color: #333333;
        overflow: hidden;
    }

    .listItem1Ratio {
        font-size: 14px;
        font-family: Roboto-Medium, Roboto;
        font-weight: 500;
        color: #2CBB79;
    }

    .listBox1 .listItem1:first-child .listItem1Ratio {
        color: #FFB94D;
    }

    .listItem1ProgressBox {
        margin-top: 5px;
        width: 100%;
        overflow: hidden;
        height: 16px;
        background: #EDEFF2;
        border-radius: 102px 102px 102px 102px;
    }

    .listItem1ProgressBar {
        height: 16px;
        background: #2CBB79;
        border-radius: 102px 102px 102px 102px;
    }

    .listBox1 .listItem1:first-child .listItem1ProgressBar {
        background: #FFB94D;
    }
</style>
<div class="layui-fluid">
    <!--    导航栏-->
    <div class="report-nav-box" id="reportNavBox" style="width: calc(100% - 15px);">
        <div class="report-nav" id="reportNav">
            <div class="report-nav-item active" name='overview'>总览</div>
            <div class="report-nav-item" name='material'>按物料</div>
            <div class="report-nav-item" name='cabinet'>按柜子</div>
            <div class="report-nav-item" name='organize'>按组织</div>
            <div class="report-nav-item" name='usage'>按使用情况</div>
        </div>
        <div class="report-nav-bar" id="reportNavBar"></div>
    </div>
    <div class="getNewInventoryReportMainBox" id="getNewInventoryReportMainBox">
        <!-- 头部报表   -->
        <div class="report-main" id="reportTop">
            <div class="report-main-box share1">
                <div class="report-main-item layui-form" id="overviewStatisticsDay">
                    <div class="report-item-header">
                        <div class="report-item-headerTitle">物料盘验统计（按天）</div>
                        <div class="report-item-headerSwitch">
                            <div class="report-item-headerSwitchItem active">按数量</div>
                            <div class="report-item-headerSwitchItem">按金额</div>
                        </div>
                        <div class="report-item-more">
                            更多<i class="layui-icon layui-icon-right"></i>
                        </div>
                    </div>
                    <div class="report-item-box">
                        <div class="report-itemEcharts"></div>
                    </div>
                </div>
            </div>
        </div>

        <div class="report" id="report">

            <!-- 标题 主柜、时间选择   -->
            <div class="report-timeSelect" id="timeSelect">
                <div class="report-timeSelect-title">物料数据统计</div>
                <div class="report-timeSelect-box layui-form" lay-filter="reportTimeSelectBox">
                    <div class="selectBox" style="width: 250px;" id="mainCabCodeBox">
                        <select name="mainCabCode" lay-filter="mainCabCode"></select>
                    </div>
                    <div class="timeSelect">
                        <select lay-filter="timeType" name="timeType">
                            <option value="day">按日</option>
                            <option value="month" selected>按月</option>
                            <option value="timeSlot">时间段</option>
                        </select>
                    </div>
                    <div class="timeFreedom">
                        <i class="layui-icon layui-icon-date" id="dayIcon"></i>
                        <input type="hidden" class="layui-input" readonly="true" id="day" placeholder="请选择日">
                        <i class="layui-icon layui-icon-date" id="monthIcon" style="display: block"></i>
                        <input type="text" class="layui-input" readonly="true" id="month" placeholder="请选择月">
                        <i class="layui-icon layui-icon-date" id="timeSlotIcon"></i>
                        <input type="hidden" class="layui-input" readonly="true" id="timeSlot" placeholder="请选择起止日期">
                    </div>
                </div>
            </div>

            <!--    卡片统计-->
            <div class="report-card share6" id="overviewCard">
                <div class="statBoxItemList" sign="1">
                    <div class="statBoxItemListContent">
                        <p class="statBoxItemListName">盘验物料总数量</p>
                        <p class="statBoxItemListNum">0</p>
                    </div>
                    <div class="statBoxItemListImg">
                        <img src="assets/images/20230913-report/directory.png">
                    </div>
                </div>
                <div class="statBoxItemList" sign="1">
                    <div class="statBoxItemListContent">
                        <p class="statBoxItemListName">盘验暂存结果</p>
                        <p class="statBoxItemListNum">0</p>
                    </div>
                    <div class="statBoxItemListImg">
                        <img src="assets/images/20230913-report/drawer.png">
                    </div>
                </div>
                <div class="statBoxItemList" sign="1">
                    <div class="statBoxItemListContent">
                        <p class="statBoxItemListName">盘验报修结果</p>
                        <p class="statBoxItemListNum">0</p>
                    </div>
                    <div class="statBoxItemListImg">
                        <img src="assets/images/20230913-report/set.png">
                    </div>
                </div>
                <div class="statBoxItemList" sign="1">
                    <div class="statBoxItemListContent">
                        <p class="statBoxItemListName">盘验报废结果</p>
                        <p class="statBoxItemListNum">0</p>
                    </div>
                    <div class="statBoxItemListImg">
                        <img src="assets/images/20230913-report/battery.png">
                    </div>
                </div>
                <div class="statBoxItemList" sign="1">
                    <div class="statBoxItemListContent">
                        <p class="statBoxItemListName">盘验规格不相符结果</p>
                        <p class="statBoxItemListNum">0</p>
                    </div>
                    <div class="statBoxItemListImg">
                        <img src="assets/images/20230913-report/warning.png">
                    </div>
                </div>
                <div class="statBoxItemList" sign="1">
                    <div class="statBoxItemListContent">
                        <p class="statBoxItemListName">盘验缺失结果</p>
                        <p class="statBoxItemListNum">0</p>
                    </div>
                    <div class="statBoxItemListImg">
                        <img src="assets/images/20230913-report/warn.png">
                    </div>
                </div>
            </div>

            <!--    报表区域-->
            <div class="report-body" id="reportBody">
                <div class="report-body-list active" id="overview">
                    <div class="report-main">
                        <div class="report-main-box share2">
                            <div class="report-main-item layui-form" id="lingxinByMaterial">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果（按物料）</div>
                                    <div class="report-item-headerSelect" style="width: 130px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="spu">按系列（SPU）</option>
                                            <option value="sku">按编号（SKU）</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                            <div class="report-main-item layui-form" id="lingxinByCabinet">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验排名（按柜子）</div>
                                    <div class="report-item-headerSelect" style="width: 100px">
                                        <select name="selectParam" lay-filter="lingxinByCabinetType">
                                            <option value="main">按主柜</option>
                                            <option value="desk">按副柜</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share2">
                            <div class="report-main-item layui-form" id="lingxinByOrganization">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验排名（按组织）</div>
                                    <div class="report-item-headerSelect" style="width: 120px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="person">按存入人</option>
                                            <option value="department">按部门</option>
                                            <option value="costCenter">按成本中心</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                            <div class="report-main-item layui-form" id="lingxinBySituation">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验排名（按使用情况）</div>
                                    <div class="report-item-headerSelect" style="width: 100px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="device">按设备</option>
                                            <option value="workOrder">按工单</option>
                                            <option value="workShop">按车间</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="causeStatistics">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">报修原因统计</div>
                                    <div class="report-item-headerSelect" style="width: 180px">
                                        <select name="creator" lay-filter="creatorSelect" lay-search="">>
                                            <option value="请选择归还人"></option>
                                        </select>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts report-itemEcharts1"></div>
                                    <div class="report-itemEcharts report-itemEcharts2"></div>
                                    <div class="report-itemEcharts report-itemEcharts3"></div>
                                </div>

                            </div>
                        </div>
                    </div>
                    <div class="report-table">
                        <div class="report-table-title">盘验记录列表</div>
                        <div class="report-table-box">
                            <table class="layui-table" id="getNewReportTable" lay-filter="getNewReportTable"></table>
                        </div>
                    </div>
                </div>
                <div class="report-body-list" id="material">
                    <div class="report-main">
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryMaterialScrap">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果(按报废)</div>
                                    <div class="report-item-headerSelect" style="width: 130px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="spu">按系列（SPU）</option>
                                            <option value="sku">按编号（SKU）</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryMaterialRepair">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果(按报修)</div>
                                    <div class="report-item-headerSelect" style="width: 130px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="spu">按系列（SPU）</option>
                                            <option value="sku">按编号（SKU）</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="reportItemCenter">
                                        <div class="report-itemEcharts"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryMaterialSpecs">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果(按规格不相符)</div>
                                    <div class="report-item-headerSelect" style="width: 130px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="spu">按系列（SPU）</option>
                                            <option value="sku">按编号（SKU）</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryMaterialStaging">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果(按暂存)</div>
                                    <div class="report-item-headerSelect" style="width: 130px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="spu">按系列（SPU）</option>
                                            <option value="sku">按编号（SKU）</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryMaterialLack">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验统计(按缺失)</div>
                                    <div class="report-item-headerSelect" style="width: 130px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="spu">按系列（SPU）</option>
                                            <option value="sku">按编号（SKU）</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="report-body-list" id="cabinet">
                    <div class="report-main">
                        <div class="report-main-box share2">
                            <div class="report-main-item layui-form" id="inventoryCabinetMain">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验排名(按主柜)</div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                            <div class="report-main-item layui-form" id="inventoryCabinetDesk">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验排名(按副柜)</div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="report-body-list" id="organize">
                    <div class="report-main">
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryOrganizeRepair">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果（报修）</div>
                                    <div class="report-item-headerSelect" style="width: 120px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="person">按存入人</option>
                                            <option value="department">按部门</option>
                                            <option value="costCenter">按成本中心</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryOrganizeScrap">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果（按报废）</div>
                                    <div class="report-item-headerSelect" style="width: 120px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="person">按存入人</option>
                                            <option value="department">按部门</option>
                                            <option value="costCenter">按成本中心</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryOrganizeSpecification">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果（按规格不相符）</div>
                                    <div class="report-item-headerSelect" style="width: 120px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="person">按存入人</option>
                                            <option value="department">按部门</option>
                                            <option value="costCenter">按成本中心</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryOrganizeLack">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果（按缺失）</div>
                                    <div class="report-item-headerSelect" style="width: 120px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="person">按存入人</option>
                                            <option value="department">按部门</option>
                                            <option value="costCenter">按成本中心</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryOrganizeStaging">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果（按暂存）</div>
                                    <div class="report-item-headerSelect" style="width: 120px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="person">按存入人</option>
                                            <option value="department">按部门</option>
                                            <option value="costCenter">按成本中心</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="report-body-list" id="usage">
                    <div class="report-main">
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryUsageRepair">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果（报修）</div>
                                    <div class="report-item-headerSelect" style="width: 100px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="device">按设备</option>
                                            <option value="workOrder">按工单</option>
                                            <option value="workShop">按车间</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryUsageScrap">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果（按报废）</div>
                                    <div class="report-item-headerSelect" style="width: 100px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="device">按设备</option>
                                            <option value="workOrder">按工单</option>
                                            <option value="workShop">按车间</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryUsageSpecification">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果（按规格不相符）</div>
                                    <div class="report-item-headerSelect" style="width: 100px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="device">按设备</option>
                                            <option value="workOrder">按工单</option>
                                            <option value="workShop">按车间</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryUsageLack">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果（按缺失）</div>
                                    <div class="report-item-headerSelect" style="width: 100px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="device">按设备</option>
                                            <option value="workOrder">按工单</option>
                                            <option value="workShop">按车间</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                        <div class="report-main-box share1">
                            <div class="report-main-item layui-form" id="inventoryUsageStaging">
                                <div class="report-item-header">
                                    <div class="report-item-headerTitle">物料盘验结果（按暂存）</div>
                                    <div class="report-item-headerSelect" style="width: 100px">
                                        <select name="selectParam" lay-filter="lingxinByOrganizationType">
                                            <option value="device">按设备</option>
                                            <option value="workOrder">按工单</option>
                                            <option value="workShop">按车间</option>
                                        </select>
                                    </div>
                                    <div class="report-item-headerSwitch">
                                        <div class="report-item-headerSwitchItem active">按数量</div>
                                        <div class="report-item-headerSwitchItem">按金额</div>
                                    </div>
                                    <div class="report-item-more">
                                        更多<i class="layui-icon layui-icon-right"></i>
                                    </div>
                                </div>
                                <div class="report-item-box">
                                    <div class="report-itemEcharts"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!--卡片弹窗-->
<script type="text/html" id="cardTemplate">
    <form lay-filter="cardTemplateForm" class="layui-form model-form"
          style="padding: 0 15px 10px;height: calc(100% - 20px);overflow: hidden;">
        <div class="open-details-box" style="height: calc(100% - 45px); overflow-y: scroll">
            <div>
                <table class="layui-table" id="cardTemplateTable" lay-filter="cardTemplateTable"></table>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
            <button type="button" class="layui-btn" id="cardTemplateExport">导出数据</button>
        </div>
    </form>
</script>

<!--数据图表弹窗-->
<script type="text/html" id="allDataChart">
    <form lay-filter="allDataChartForm" class="layui-form model-form"
          style="padding: 10px 15px;height: calc(100% - 20px);overflow: hidden;">
        <div class="open-details-box" style="height: calc(100% - 45px); overflow-y: scroll">
            <div class="layui-row table-bor" style="height: calc(100% - 10px);" id="allDataChartFormchartDom"></div>
            <div style="display: none" id="allDataChartTableBox">
                <table class="layui-table" id="allDataChartTable" lay-filter="allDataChartTable"
                       style="display: none"></table>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
            <button type="button" class="layui-btn" id="allDataChartFormExport">导出数据</button>
        </div>
    </form>
</script>

<!--listBox1模板-->
<script id="listBox1" type="text/html">
    {{#
    var isNullObj = function (_data) {
    if (_data) {
    if (JSON.stringify(_data) == "{}") { return '0%' } else { return _data }
    }
    return '0%';
    }
    }}

    {{#
    var eleWidth = function(_value,_oneValue){
    return "width:"+(_value/(_oneValue>0?_oneValue:1))*100+"%"
    }
    }}

    {{#  layui.each(d, function(index, item){ }}
    <div class="listItem1">
        <div class="listItem1Index">{{ index+1 }}</div>
        <div class="listItem1Content">
            <div class="listItem1Top">
                <div class="listItem1Name">{{ item.name }}</div>
                <div class="listItem1Value">{{ item.value }}</div>
                <div class="listItem1Ratio">{{ isNullObj(item.ratio) }}</div>
            </div>
            <div class="listItem1ProgressBox">
                <div class="listItem1ProgressBar" style="{{ eleWidth(item.value, d[0].value) }}"></div>
            </div>
        </div>
    </div>
    {{#  }); }}
    {{#  if(d.length === 0){ }}
    <h2 style="text-align: center; line-height: 100px;">暂无内容~~~</h2>
    {{#  } }}

</script>

<!-- js部分 -->
<script src="/admin/assets/libs/echarts/echarts.min.js"></script>
<script src="/admin/assets/libs/echarts/echartsTheme.js"></script>

<script>
    layui.use(['layer', 'element', 'config', 'admin', 'form', 'table', 'laydate'], function () {
        let $ = layui.jquery;
        let {layer, element, config, table, admin, form, laydate, laytpl} = layui;

        //页面配置信息
        let configData = {
                'overview': {
                    title: '总览',
                    id: 'overview',
                    reportTopShow: true,
                    reportTop: {
                        id: 'overviewStatisticsDay',
                        title: '物料盘验统计（按天）',
                        url: 'enterprisecab/bill/admin/checkNewReport/list',
                        style: 1,
                        sort: false,
                        data: [],
                        size: 100,
                        parameter: {
                            param: 'qua', //qua 数量 money 金额
                        }
                    },
                    tableShow: true,
                    table: {
                        title: '物料盘验列表',
                        id: 'getNewReportTable',
                        url: 'enterprisecab/bill/admin/checkNewReport/dataList',
                        data: [],
                        cols: [
                            {type: 'numbers', title: '序号', fixed: 'left'}
                            , {field: 'code', sort: true, title: '盘验编号', width: 150}
                            , {field: 'quantity', sort: true, title: '数量'}
                            , {field: 'departmentName', title: '部门'}
                            , {field: 'costCenter', title: '成本中心'}
                            , {field: 'cabName', title: '柜子名称', width: 130}
                            , {field: 'cabCode', title: '柜子编号', width: 130}
                            , {field: 'spaceCode', title: '货位编号'}
                            , {
                                field: 'isTradeIn',
                                title: '是否以旧换新',
                                width: 120,
                                templet: d => d.isTradeIn ? d.isTradeIn : "-"
                            }
                            , {field: 'businessTypePreDesc', title: '盘验前状态', width: 120}
                            , {field: 'businessTypeDesc', title: '盘验后状态'}
                            , {field: 'creatorName', sort: true, title: '盘验人', width: 110}
                            , {field: 'createTime', sort: true, title: '盘验时间', width: 160}
                            , {
                                field: 'status',
                                sort: true,
                                title: '盘验状态',
                                templet: d => d.status == 'created' ? '待盘验' : '已盘验'
                            }
                        ]
                    },
                    reportMain: {
                        lingxinByMaterial: {
                            id: 'lingxinByMaterial',
                            title: '物料盘验情况（按物料）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFirstChartNew',
                            data: [],
                            size: 10,
                            sort: true,
                            style: 6,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'spu',
                                tab: 'tab0'
                            },
                        },
                        lingxinByCabinet: {
                            id: 'lingxinByCabinet',
                            title: '物料盘验情况（按柜子）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midSecondChartNew',
                            data: [],
                            size: 8,
                            sort: true,
                            style: 2,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'main',
                                tab: 'tab0'
                            },
                        },
                        lingxinByOrganization: {
                            id: 'lingxinByOrganization',
                            title: '物料盘验情况（按组织）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midThirdChartNew',
                            data: [],
                            size: 10,
                            style: 6,
                            sort: true,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'person',
                                tab: 'tab0'
                            },
                        },
                        lingxinBySituation: {
                            id: 'lingxinBySituation',
                            title: '物料盘验情况（按使用情况）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFourChartNew',
                            data: [],
                            size: 10,
                            sort: true,
                            style: 6,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'device',
                                tab: 'tab0'
                            },
                        },
                        causeStatistics: {
                            id: 'causeStatistics',
                            title: '盘验结果统计',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFiveChartNew?businessTypePre=1',
                            url2: 'enterprisecab/bill/admin/checkNewReport/midFiveChartNew?businessTypePre=2',
                            url3: 'enterprisecab/bill/admin/checkNewReport/midFiveChartNew?businessTypePre=3',
                            data: [],
                            data2: [],
                            data3: [],
                            subTitle: '暂存盘验数',
                            subTitle2: '报修盘验数',
                            subTitle3: '报废盘验数',
                            size: 5,
                            sort: true,
                            style: 7,
                            parameter: { // 请求参数
                                creator: ''
                            },
                        },
                    }
                },
                'material': {
                    title: '按物料',
                    id: 'material',
                    reportTopShow: false,
                    reportTop: {
                        id: 'overviewStatisticsDay',
                        title: '物料盘验统计（按天）',
                        url: '',
                        style: 1,
                        data: [],
                        sort: false,
                        size: 10,
                        parameter: {
                            param: 'qua', //qua 数量 money 金额
                        }
                    },
                    tableShow: false,
                    table: {
                        title: '',
                        id: '',
                        url: '',
                        data: [],
                        cols: [
                            {type: 'numbers', title: '序号'}
                        ]
                    },
                    reportMain: {
                        inventoryMaterialScrap: {
                            id: 'inventoryMaterialScrap',
                            title: '物料盘验结果（按报废）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFirstChartNew',
                            data: [],
                            size: 20,
                            sort: true,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'spu',
                                tab: 'tab1',
                                businessType: '3'
                            },
                        },
                        inventoryMaterialRepair: {
                            id: 'inventoryMaterialRepair',
                            title: '物料盘验结果（按报修）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFirstChartNew',
                            data: [],
                            size: 23,
                            sort: true,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'spu',
                                tab: 'tab1',
                                businessType: '2'
                            },
                        },
                        inventoryMaterialSpecs: {
                            id: 'inventoryMaterialSpecs',
                            title: '物料盘验结果（按规格不相符）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFirstChartNew',
                            data: [],
                            size: 8,
                            sort: true,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'spu',
                                tab: 'tab1',
                                businessType: null,
                            },
                        },
                        inventoryMaterialLack: {
                            id: 'inventoryMaterialLack',
                            title: '物料盘验结果（按缺失）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFirstChartNew',
                            data: [],
                            size: 8,
                            sort: true,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'spu',
                                tab: 'tab1',
                                businessType: '0'
                            },
                        },
                        inventoryMaterialStaging: {
                            id: 'inventoryMaterialStaging',
                            title: '物料盘验结果（按暂存）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFirstChartNew',
                            data: [],
                            size: 8,
                            sort: true,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'spu',
                                tab: 'tab1',
                                businessType: '1'
                            },
                        }
                    }
                },
                'cabinet': {
                    title: '按柜子',
                    id: 'cabinet',
                    reportTopShow: false,
                    reportTop: {
                        id: 'overviewStatisticsDay',
                        title: '物料盘验统计（按天）',
                        url: '',
                        style: 1,
                        sort: false,
                        data: [],
                        size: 10,
                        parameter: {
                            param: 'qua', //qua 数量 money 金额
                        }
                    },
                    tableShow: false,
                    table: {
                        title: '',
                        id: '',
                        url: '',
                        data: [],
                        cols: [
                            {type: 'numbers', title: '序号'}
                        ]
                    },
                    reportMain: {
                        inventoryCabinetMain: {
                            id: 'inventoryCabinetMain',
                            title: '物料盘验排名(按主柜)',
                            url: 'enterprisecab/bill/admin/checkNewReport/midSecondChartNew',
                            data: [],
                            size: 8,
                            sort: true,
                            style: 2,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'main',
                                tab: 'tab1',
                            },
                        },
                        inventoryCabinetDesk: {
                            id: 'inventoryCabinetDesk',
                            title: '物料盘验排名(按副柜)',
                            url: 'enterprisecab/bill/admin/checkNewReport/midSecondChartNew',
                            data: [],
                            size: 8,
                            sort: true,
                            style: 2,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'desk',
                                tab: 'tab1',
                            },
                        },
                    }
                },
                'organize': {
                    title: '按组织',
                    id: 'organize',
                    reportTopShow: false,
                    reportTop: {
                        id: 'overviewStatisticsDay',
                        title: '物料盘验统计（按天）',
                        url: '',
                        style: 1,
                        sort: false,
                        data: [],
                        size: 10,
                        parameter: {
                            param: 'qua', //qua 数量 money 金额
                        }
                    },
                    tableShow: false,
                    table: {
                        title: '',
                        id: '',
                        url: '',
                        data: [],
                        cols: [
                            {type: 'numbers', title: '序号'}
                        ]
                    },
                    reportMain: {
                        inventoryOrganizeRepair: {
                            id: 'inventoryOrganizeRepair',
                            title: '物料盘验结果（报修）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midThirdChartNew',
                            data: [],
                            size: 10,
                            sort: true,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'person',
                                tab: 'tab1',
                                businessType: '2'
                            },
                        },
                        inventoryOrganizeScrap: {
                            id: 'inventoryOrganizeScrap',
                            title: '物料盘验结果（按报废）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midThirdChartNew',
                            data: [],
                            size: 8,
                            sort: true,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'person',
                                tab: 'tab1',
                                businessType: '3'
                            },
                        },
                        inventoryOrganizeSpecification: {
                            id: 'inventoryOrganizeSpecification',
                            title: '物料盘验结果（按规格不相符）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midThirdChartNew',
                            data: [],
                            size: 8,
                            sort: true,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'person',
                                tab: 'tab1',
                                businessType: null
                            },
                        },
                        inventoryOrganizeLack: {
                            id: 'inventoryOrganizeLack',
                            title: '物料盘验结果（按缺失）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midThirdChartNew',
                            data: [],
                            size: 8,
                            sort: true,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'person',
                                tab: 'tab1',
                                businessType: '0'
                            },
                        },
                        inventoryOrganizeStaging: {
                            id: 'inventoryOrganizeStaging',
                            title: '物料盘验结果（按暂存）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midThirdChartNew',
                            data: [],
                            size: 8,
                            sort: true,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'person',
                                tab: 'tab1',
                                businessType: '1'
                            },
                        },
                    }
                },
                'usage': {
                    title: '按使用情况',
                    id: 'usage',
                    reportTopShow: false,
                    reportTop: {
                        id: 'overviewStatisticsDay',
                        title: '物料盘验统计（按天）',
                        url: '',
                        style: 1,
                        sort: false,
                        data: [],
                        size: 10,
                        parameter: {
                            param: 'qua', //qua 数量 money 金额
                        }
                    },
                    tableShow: false,
                    table: {
                        title: '',
                        id: '',
                        url: '',
                        data: [],
                        cols: [
                            {type: 'numbers', title: '序号'}
                        ]
                    },
                    reportMain: {
                        inventoryUsageRepair: {
                            id: 'inventoryUsageRepair',
                            title: '物料盘验结果（报修）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFourChartNew',
                            data: [],
                            sort: true,
                            size: 10,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'device',
                                tab: 'tab1',
                                businessType: '2'
                            },
                        },
                        inventoryUsageScrap: {
                            id: 'inventoryUsageScrap',
                            title: '物料盘验结果（按报废）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFourChartNew',
                            data: [],
                            sort: true,
                            size: 10,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'device',
                                tab: 'tab1',
                                businessType: '3'
                            },
                        },
                        inventoryUsageSpecification: {
                            id: 'inventoryUsageSpecification',
                            title: '物料盘验结果（按规格不相符）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFourChartNew',
                            data: [],
                            sort: true,
                            size: 10,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'device',
                                tab: 'tab1',
                                businessType: null
                            },
                        },
                        inventoryUsageLack: {
                            id: 'inventoryUsageLack',
                            title: '物料盘验结果（按缺失）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFourChartNew',
                            data: [],
                            sort: true,
                            size: 10,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'device',
                                tab: 'tab1',
                                businessType: '0'
                            },
                        },
                        inventoryUsageStaging: {
                            id: 'inventoryUsageStaging',
                            title: '物料盘验结果（按暂存）',
                            url: 'enterprisecab/bill/admin/checkNewReport/midFourChartNew',
                            data: [],
                            sort: true,
                            size: 10,
                            style: 1,
                            parameter: { // 请求参数
                                param: 'qua',
                                selectParam: 'device',
                                tab: 'tab1',
                                businessType: '1'
                            },
                        },
                    }
                },
            },
            activeConfigData = configData['overview'],
            headerTime = {
                endTime: '', //结束时间
                startTime: '',//开始时间
                mainCabCode: ''
            },
            colorList = ['#009C5E', '#2CBB79', '#AAD976', '#FBC235', '#FAD865'];

        //声明时间
        let currentDate = new Date();
        let currentYear = currentDate.getFullYear(),
            currentMonth = (currentDate.getMonth() + 1) > 9 ? (currentDate.getMonth() + 1) : '0' + (currentDate.getMonth() + 1),
            currentDay = currentDate.getDate() > 9 ? currentDate.getDate() : '0' + currentDate.getDate();

        //声明默认搜索时间
        let timeSlotStart = currentYear + '-' + currentMonth + '-01 00:00:00',
            timeSlotEnd = currentYear + '-' + currentMonth + '-' + getMonthDays(currentYear, currentMonth) + ' 23:59:59';

        init();

        function init() {
            headerTime.startTime = timeSlotStart;
            headerTime.endTime = timeSlotEnd;

            //请求头部报表数据
            getReportTopData(activeConfigData);

            // 请求物料数据统计卡片数据
            getReportCard();

            // 请求所有报表数据
            getAllReportData(activeConfigData.reportMain);

            //table
            showTable(activeConfigData);
        }

        // 初始化导航栏Bar
        $('#reportNavBar').css({
            left: $('#reportNav>div').eq(0).position().left + ($('#reportNav>div').eq(0).outerWidth(true) / 2) + 'px',
            width: ($('#reportNav>div').eq(0).outerWidth(true) - 40) + 'px'
        });

        // 导航栏切换
        $('#reportNav>div').click(function () {

            // headerTime.startTime = timeSlotStart;
            // headerTime.endTime = timeSlotEnd;
            // headerTime.mainCabCode ='';

            activeConfigData = configData[$(this).attr('name')];

            // 更改导航栏样式
            $(this).addClass('active').siblings().removeClass('active');

            //更改导航栏Bar位置
            $('#reportNavBar').css({
                left: $(this).position().left + ($(this).outerWidth(true) / 2) + 'px',
                width: ($(this).outerWidth(true) - 40) + 'px'
            });

            //更改内容区域对应的盒子显示隐藏
            $('.report-body>div').eq($(this).index()).show(300, function () {
                getReportCard();
                //底部所有报表
                getAllReportData(activeConfigData.reportMain);
                showTable(activeConfigData)
            }).siblings().hide(300);

            // 显示隐藏 （总览 物料盘验统计(按天)）
            if ($(this).index() === 0) {
                $('#reportTop').show(100, function () {
                    // 头部报表
                    getReportTopData(activeConfigData);
                })
            } else {
                $('#reportTop').hide()
            }
            //回到顶部
            $('#reportNavBox').css({'position': 'relative', top: '0'});
            $('#timeSelect').css({'position': 'relative', top: '0'});
            $('#overviewCard').css({marginTop: "0"});
            $('#getNewInventoryReportMainBox').animate({scrollTop: 0});

            //重置时间 时间选项 主柜选项
            // timeTypeFun('month');
            // form.val('reportTimeSelectBox', {mainCabCode: '', timeType: 'month'});
            // init();

        });


        // 滚动条
        $('#getNewInventoryReportMainBox').scroll(function (e) {
            let reportWidth = $('#report').parent().width() - 10 + "px";
            // console.log($('#reportTop').offset())
            if (activeConfigData.id == "overview") {
                if ($('#reportTop').offset().top <= -300) {
                    // $('#reportNavBox').css({position: 'fixed', top: '101px', width: reportWidth});
                    $('#timeSelect').css({position: 'fixed', top: '182px', width: reportWidth});
                    $('#overviewCard').css({marginTop: "90px"});
                } else {
                    // $('#reportNavBox').css({'position': 'relative', top: '0'});
                    $('#timeSelect').css({'position': 'relative', top: '0'});
                    $('#overviewCard').css({marginTop: "0"})
                }
            } else {
                // $('#reportNavBox').css({position: 'fixed', top: '101px', width: reportWidth});
                $('#timeSelect').css({position: 'fixed', top: '182px', width: reportWidth});
                $('#overviewCard').css({marginTop: "70px"});
            }
        });

        form.render('select');

        //请求主柜下拉数据
        admin.req('enterprisecab/cabinet/admin/cabinet/getCabinetByCabinetNature?limit=9999', {}, res => {
            if (res.code === 200) {
                loadReportSelectHtml(res.data, "所有主柜", 'mainCabCode', 2, '#mainCabCodeBox')
            } else {
                loadReportSelectHtml([], "所有主柜", 'mainCabCode', 2, '#mainCabCodeBox')
            }
        }, 'get');

        //主柜下拉选项
        form.on('select(mainCabCode)', function (data) {
            headerTime.mainCabCode = data.value;

            getReportCard();
            getAllReportData(activeConfigData.reportMain);
            showTable(activeConfigData);
        });

        //时间下拉选项操作
        form.on('select(timeType)', function (data) {
            timeTypeFun(data.value);
        });

        function timeTypeFun(_type) {
            $('.timeFreedom>i').hide();
            $('.timeFreedom>input').attr('type', 'hidden');
            $('.timeFreedom>i[id=' + _type + 'Icon]').show();
            $('.timeFreedom>input[id=' + _type + ']').attr('type', 'text');

            if (_type === 'day') {
                headerTime.startTime = currentYear + '-' + currentMonth + '-' + currentDay + ' 00:00:00';
                headerTime.endTime = currentYear + '-' + currentMonth + '-' + currentDay + ' 23:59:59';
                $('.timeFreedom>input[id=' + _type + ']').val(day.config.value);
            } else if (_type === 'month') {
                headerTime.startTime = timeSlotStart;
                headerTime.endTime = timeSlotEnd;
                $('.timeFreedom>input[id=' + _type + ']').val(month.config.value);
            } else if (_type === 'timeSlot') {
                headerTime.startTime = currentYear + '-' + currentMonth + '-' + currentDay + ' 00:00:00';
                headerTime.endTime = currentYear + '-' + currentMonth + '-' + currentDay + ' 23:59:59';
                $('.timeFreedom>input[id=' + _type + ']').val(timeSlot.config.value);
            }

            //头部卡片数据
            getReportCard();
            getAllReportData(activeConfigData.reportMain);
            showTable(activeConfigData);
        }

        //初始化时间选择
        let day = laydate.render({
            elem: '#day',
            type: 'date',
            eventElem: '#dayIcon',
            value: currentYear + '-' + currentMonth + '-' + currentDay,
            trigger: 'click',
            done: function (value, date, endDate) {
                if (value) {
                    headerTime.startTime = value + " 00:00:00";
                    headerTime.endTime = value + " 23:59:59";
                } else {
                    headerTime.startTime = currentYear + '-' + currentMonth + '-' + currentDay + ' 00:00:00';
                    headerTime.endTime = currentYear + '-' + currentMonth + '-' + currentDay + ' 23:59:59';
                    this.elem.val(this.value)
                }

                //头部卡片数据
                getReportCard();
                getAllReportData(activeConfigData.reportMain);
                showTable(activeConfigData);
            }
        });
        let month = laydate.render({
            elem: '#month',
            type: 'month',
            eventElem: '#monthIcon',
            value: currentYear + '-' + currentMonth,
            trigger: 'click',
            done: function (value, date, endDate) {
                if (value) {
                    headerTime.startTime = value + "-01 00:00:00";
                    headerTime.endTime = value + "-" + getMonthDays(date.year, date.month) + " 23:59:59";
                } else {
                    headerTime.startTime = timeSlotStart;
                    headerTime.endTime = timeSlotEnd;
                    this.elem.val(this.value)
                }

                //头部卡片数据
                getReportCard();
                getAllReportData(activeConfigData.reportMain);
                showTable(activeConfigData);
            }
        });
        let timeSlot = laydate.render({
            elem: '#timeSlot',
            type: 'date',
            eventElem: '#timeSlotIconIcon',
            trigger: 'click',
            value: (currentYear + '-' + currentMonth + '-' + currentDay) + ' 至 ' + (currentYear + '-' + currentMonth + '-' + currentDay),
            range: "至",
            done: function (value, date, endDate) {
                if (value) {
                    let timeArray = value.split("至");
                    headerTime.startTime = timeArray[0].trim() + " 00:00:00";
                    headerTime.endTime = timeArray[1].trim() + " 23:59:59";
                } else {
                    headerTime.startTime = currentYear + '-' + currentMonth + '-' + currentDay + ' 00:00:00';
                    headerTime.endTime = currentYear + '-' + currentMonth + '-' + currentDay + ' 23:59:59';
                    this.elem.val(this.value)
                }
                //头部卡片数据
                getReportCard();
                getAllReportData(activeConfigData.reportMain);
                showTable(activeConfigData);
            }
        });


        //头部报表（按天）
        // 请求头部报表数据
        function getReportTopData(_data) {
            if (_data.reportTopShow) {
                admin.req(activeConfigData.reportTop.url, activeConfigData.reportTop.parameter, res => {
                    if (res.code === 200) {
                        activeConfigData.reportTop.data = res.data.data;
                        activeConfigData.reportTop.title = res.data.title;
                    }
                    showReportTop(activeConfigData.reportTop)
                })
            } else {
                return false
            }
        }

        //头部报表切换
        $('#overviewStatisticsDay .report-item-headerSwitch>div').click(function () {
            $(this).index() === 0 ? activeConfigData.reportTop.parameter.param = 'qua' : activeConfigData.reportTop.parameter.param = 'money';
            $(this).addClass('active').siblings().removeClass('active');
            getReportTopData(activeConfigData)
        });

        // 渲染头部报表
        function showReportTop(_obj) {
            $('#' + _obj.id).find('.report-item-headerTitle').text(_obj.name);
            let _elem = document.getElementById(_obj.id).querySelector('.report-itemEcharts');
            $(_elem).attr('_echarts_instance_', '');
            const chartDom = _elem;
            const myChart = echarts.init(chartDom);
            let xAxisData = [], option, data1 = [];
            let data = _obj.data;

            data.forEach(item => {
                xAxisData.push(item.name);
                data1.push(item.value1)
            });

            option = {
                tooltip: {
                    trigger: "axis",
                    padding: 0,
                    backgroundColor: 'rgba(255,255,255,.7)',
                    formatter: function (parms) {
                        let htmlStr = '', str = '';
                        parms.forEach(item => {
                            htmlStr += `<div style='display: flex;font-size: 12px;color: #333;justify-content: space-between;'>
                                           <div style="margin-right: 30px">${item.marker}${item.seriesName}</div>
                                           <div>${item.value}</div>
                                       </div>`
                        });
                        str = "<div style='border-radius:5px;background-color: #fff;box-shadow: 0 0 10px 0 rgba(0,0,0,0.2);padding: 15px;min-width: 120px;'>" +
                            "<div style='font-size: 14px;font-weight: 400;color: #666'>" + parms[0].name + "</div>" + htmlStr + "</div>";
                        return str;
                    }
                },
                grid: {
                    top: '30',//上边距
                    right: '25',//右边距
                    left: '25',//左边距
                    bottom: '10%',//下边距
                    containLabel: true,
                },
                legend: [
                    {
                        data: ['数量(基础数量计)'],
                        icon: 'line',
                        left: '15%',
                        itemWidth: 20,
                        itemHeight: 20,
                        textStyle: {
                            fontSize: 16
                        }
                    },

                ],
                xAxis: {
                    type: 'category',
                    data: xAxisData,
                    axisLabel: {
                        formatter: (v) => v.slice(0, 10)
                    },
                    axisTick: {
                        show: false //隐藏X轴刻度
                    },
                    axisLine: {
                        lineStyle: {
                            color: "#000"
                        }
                    },
                },
                yAxis: [
                    {
                        type: 'value',
                        name: '数量(基础单位)',
                        axisLabel: {
                            color: 'rgba(0,0,0,0.65)',
                            textStyle: {
                                fontSize: 14
                            },
                        },
                        axisLine: {
                            show: false,
                            lineStyle: {
                                color: 'rgba(223, 223, 223, 1)',
                            }
                        },
                        axisTick: {
                            show: false
                        },
                        splitLine: {
                            lineStyle: {
                                color: 'rgba(223, 223, 223, 1)',
                                type: "dashed",
                            }
                        }
                    }
                ],
                series: [
                    {
                        name: '数量(基础数量计)',
                        type: 'line',
                        data: data,
                        symbolSize: 8, //标记的大小
                        yAxisIndex: 0,
                        lineStyle: {
                            color: "#009C5E",
                            width: 3,
                        },
                        itemStyle: {
                            //折线拐点标志的样式
                            color: "#009C5E",
                            borderWidth: 4,
                        },
                    }
                ],
                dataZoom: [{
                    show: true,
                    height: 30,
                    xAxisIndex: [0],
                    bottom: 0,
                    start: 100 - (15 / data.length) * 100,
                    end: 100,
                    handleSize: '110%',
                    handleStyle: {color: "#009C5E"},
                    textStyle: {color: "#000"},
                    fillerColor: "rgb(0,181,89,0.3)",
                    borderColor: "rgb(0,181,89,0.3)",

                }],
            };
            option && myChart.setOption(option, true);
        }


        //请求物料数据统计卡片数据
        function getReportCard(_click) {
            let click = _click || 0;
            admin.req('enterprisecab/bill/admin/checkNewReport/topCell', Object.assign({}, headerTime, {click}), res => {
                if (res.code === 200) {
                    showReportCard(res.data);
                    // showReportCard(cardData);
                }
            })
        }

        // 渲染物料数据统计卡片数据
        function showReportCard(_data) {
            if (_data && _data.length > 0) {
                _data.forEach((item, index) => {
                    $('#overviewCard .statBoxItemList').eq(index).find('.statBoxItemListName').text(item.title);
                    $('#overviewCard .statBoxItemList').eq(index).find('.statBoxItemListNum').text(item.value);
                    $('#overviewCard .statBoxItemList').eq(index).attr('sign', item.sign);

                    if (item.title1) {
                        $('#overviewCard .statBoxItemList').eq(index).find('.statBoxItemListName1').text(item.title1);
                        $('#overviewCard .statBoxItemList').eq(index).find('.statBoxItemListNum1').text(item.value1);
                    }
                    if (item.title2) {
                        $('#overviewCard .statBoxItemList').eq(index).find('.statBoxItemListName2').text(item.title2);
                        $('#overviewCard .statBoxItemList').eq(index).find('.statBoxItemListNum2').text(item.value2);
                    }
                })
            }
        }

        // 头部卡片点击事件
        $('#overviewCard .statBoxItemList').click(function () {
            let that = $(this);
            admin.open({
                type: 1,
                area: ['1280px', '750px'],
                offset: '65px',
                title: that.find('.statBoxItemListName').text(),
                content: $('#cardTemplate').html(),
                success: function () {
                    let colsData = [
                        {type: 'numbers', 'title': '序号'}
                        , {field: 'skuCode', sort: true, title: '物料编号'}
                        , {field: 'cabCode', sort: true, title: '柜子编号'}
                        , {field: 'spaceCode', sort: true, title: '货道编码'}
                        , {field: 'quantity', sort: true, title: '数量'}
                        , {field: 'creatorName', sort: true, title: '创建人'}
                    ], materialDataData = [];

                    if (that.attr('sign') == 1) {
                        colsData = [
                            {type: 'numbers', 'title': '序号'}
                            , {field: 'skuCode', sort: true, title: '物料编号'}
                            , {field: 'cabCode', sort: true, title: '柜子编号'}
                            , {field: 'spaceCode', sort: true, title: '货道编码'}
                            , {field: 'quantity', sort: true, title: '数量'}
                            , {field: 'creatorName', sort: true, title: '创建人'}

                        ];
                    } else if (that.attr('sign') == 2) {
                        colsData = [
                            {type: 'numbers', 'title': '序号'}
                            , {field: 'skuCode', sort: true, title: '物料编号'}
                            , {field: 'cabCode', sort: true, title: '柜子编号'}
                            , {field: 'spaceCode', sort: true, title: '货道编码'}
                            , {field: 'quantity', sort: true, title: '数量'}
                            , {field: 'creatorName', sort: true, title: '创建人'}
                        ];
                    } else if (that.attr('sign') == 3) {
                        colsData = [
                            {type: 'numbers', 'title': '序号'}
                            , {field: 'skuCode', sort: true, title: '物料编号'}
                            , {field: 'cabCode', sort: true, title: '柜子编号'}
                            , {field: 'spaceCode', sort: true, title: '货道编码'}
                            , {field: 'quantity', sort: true, title: '数量'}
                            , {field: 'creatorName', sort: true, title: '创建人'}
                        ];
                    } else if (that.attr('sign') == 4) {
                        colsData = [
                            {type: 'numbers', 'title': '序号'}
                            , {field: 'skuCode', sort: true, title: '物料编号'}
                            , {field: 'cabCode', sort: true, title: '柜子编号'}
                            , {field: 'spaceCode', sort: true, title: '货道编码'}
                            , {field: 'quantity', sort: true, title: '数量'}
                            , {field: 'creatorName', sort: true, title: '创建人'}
                        ];
                    }else if (that.attr('sign') == 5) {
                        colsData = [
                            {type: 'numbers', 'title': '序号'}
                            , {field: 'skuCode', sort: true, title: '物料编号'}
                            , {field: 'cabCode', sort: true, title: '柜子编号'}
                            , {field: 'spaceCode', sort: true, title: '货道编码'}
                            , {field: 'quantity', sort: true, title: '数量'}
                            , {field: 'creatorName', sort: true, title: '创建人'}
                        ];
                    }else if (that.attr('sign') == 6) {
                        colsData = [
                            {type: 'numbers', 'title': '序号'}
                            , {field: 'skuCode', sort: true, title: '物料编号'}
                            , {field: 'cabCode', sort: true, title: '柜子编号'}
                            , {field: 'spaceCode', sort: true, title: '货道编码'}
                            , {field: 'quantity', sort: true, title: '数量'}
                            , {field: 'creatorName', sort: true, title: '创建人'}
                        ];
                    }

                    admin.reqSync('enterprisecab/bill/admin/checkNewReport/topCell', Object.assign({}, headerTime, {click: that.index() + 1}), res => {
                        if (res.code === 200) {
                            materialDataData = res.data;
                        }
                    });

                    let materialDataTb = table.render({
                        elem: '#cardTemplateTable',
                        data: materialDataData,
                        cellMinWidth: 100,
                        page: true,
                        cols: [colsData],
                        done: function (res, curr, count) {
                            if (count === 0) {
                                $('#cardTemplateExport').hide();
                            } else {
                                $('#cardTemplateExport').show();
                                $('#cardTemplateExport').click(function () {
                                    table.exportFile(materialDataTb.config.id, materialDataData, 'xls', that.find('.statBoxItemListName').text())
                                })
                            }
                        }
                    });

                }
            });
        });

        //数量金额切换
        $('#reportBody .report-item-headerSwitch>div').click(function () {

            if (!$(this).hasClass('active')) {
                let obj = {};
                //qua 数量  money金额
                activeConfigData.reportMain[$(this).parents('.report-main-item').attr('id')].parameter.param = $(this).index() === 0 ? 'qua' : 'money';
                //
                obj[$(this).parents('.report-main-item').attr('id')] = activeConfigData.reportMain[$(this).parents('.report-main-item').attr('id')];

                getAllReportData(obj);

                $(this).addClass('active').siblings().removeClass('active');
            }
        });

        form.on('select', function (data) {
            if ($(data.elem).parents('#reportBody').attr('id') === 'reportBody') {
                let obj = {};
                activeConfigData.reportMain[$(data.elem).parents('.report-main-item').attr('id')].parameter[$(data.elem).attr('name')] = data.value;
                obj[$(data.elem).parents('.report-main-item').attr('id')] = activeConfigData.reportMain[$(data.elem).parents('.report-main-item').attr('id')];
                getAllReportData(obj);

            } else {
                return false
            }

        });

        //请求报表数据
        function getAllReportData(_data) {
            for (let _key in _data) {
                admin.req(activeConfigData.reportMain[_key].url, Object.assign({}, headerTime, activeConfigData.reportMain[_key].parameter), res => {
                    if (res.code === 200) {
                        activeConfigData.reportMain[_key].data = res.data.data;
                        activeConfigData.reportMain[_key].title = res.data.title || activeConfigData.reportMain[_key].title;
                        if (res.data.totalSum) {
                            activeConfigData.reportMain[_key].totalSum = res.data.totalSum;
                        }
                        if (res.data.unit) {
                            activeConfigData.reportMain[_key].unit = res.data.unit;
                        }
                        if (res.data.totalSumOne) {
                            activeConfigData.reportMain[_key].totalSumOne = res.data.totalSumOne;
                        }
                    } else {
                        activeConfigData.reportMain[_key].data = [];
                    }
                    initReport(activeConfigData.reportMain[_key]);
                });
                if (activeConfigData.reportMain[_key].url2) {
                    admin.req(activeConfigData.reportMain[_key].url2, Object.assign({}, headerTime, activeConfigData.reportMain[_key].parameter), res => {
                        if (res.code === 200) {
                            activeConfigData.reportMain[_key].data2 = res.data.data;
                            if (res.data.totalSum) {
                                activeConfigData.reportMain[_key].totalSum2 = res.data.totalSum;
                            }
                            if (res.data.unit) {
                                activeConfigData.reportMain[_key].unit2 = res.data.unit;
                            }
                            if (res.data.totalSumOne) {
                                activeConfigData.reportMain[_key].totalSumOne2 = res.data.totalSumOne;
                            }
                        } else {
                            activeConfigData.reportMain[_key].data2 = [];
                        }
                        initReport(activeConfigData.reportMain[_key], 2);
                    });
                }
                if (activeConfigData.reportMain[_key].url3) {
                    admin.req(activeConfigData.reportMain[_key].url3, Object.assign({}, headerTime, activeConfigData.reportMain[_key].parameter), res => {
                        if (res.code === 200) {
                            activeConfigData.reportMain[_key].data3 = res.data.data;
                            if (res.data.totalSum) {
                                activeConfigData.reportMain[_key].totalSum3 = res.data.totalSum;
                            }
                            if (res.data.unit) {
                                activeConfigData.reportMain[_key].unit3 = res.data.unit;
                            }
                            if (res.data.totalSumOne) {
                                activeConfigData.reportMain[_key].totalSumOne3 = res.data.totalSumOne;
                            }
                        } else {
                            activeConfigData.reportMain[_key].data3 = [];
                        }
                        initReport(activeConfigData.reportMain[_key], 3);
                    });
                }
            }
        }

        // 初始化报表
        function initReport(_data, _type) {
            $('#' + _data.id).find('.report-item-headerTitle').text(_data.title);
            //eval('showReportTemplate' + _data.style + '(' + JSON.stringify(_data) + ')')

            switch (_data.style) {
                case 1:
                    showReportTemplate1(_data);
                    break;
                case 2:
                    showReportTemplate2(_data);
                    break;
                case 3:
                    showReportTemplate3(_data);
                    break;
                case 4:
                    showReportTemplate4(_data);
                    break;
                case 5:
                    showReportTemplate5(_data);
                    break;
                case 6:
                    showReportTemplate6(_data);
                    break;
                case 7:
                    showReportTemplate7(_data, _type);
                    break;
                default:
            }
        }

        //报表模板1
        function showReportTemplate1(_obj) {
            let _elem = document.getElementById(_obj.id).querySelector('.report-itemEcharts');
            $(_elem).attr('_echarts_instance_', '');
            let colorArray = {
                'inventoryMaterialScrap': ['#F77234'],
                'inventoryMaterialRepair': ['#FFB94D'],
                'inventoryMaterialSpecs': ['#AC31E4'],
                'inventoryMaterialStaging': ['#CCCCCC'],
                'inventoryMaterialLack': ['#2F75FB'],

                'inventoryOrganizeRepair': ['#F77234'],
                'inventoryOrganizeScrap': ['#FFB94D'],
                'inventoryOrganizeSpecification': ['#AC31E4'],
                'inventoryOrganizeLack': ['#CCCCCC'],
                'inventoryOrganizeStaging': ['#2F75FB'],

                'inventoryUsageRepair': ['#F77234'],
                'inventoryUsageScrap': ['#FFB94D'],
                'inventoryUsageSpecification': ['#AC31E4'],
                'inventoryUsageLack': ['#CCCCCC'],
                'inventoryUsageStaging': ['#2F75FB'],
            }, barBorderRadius = {
                '1': [0, 0, 0, 0],
            };

            const myChart = echarts.init(_elem);

            let seriesData = [], xAxisData = [], option = {};
            let data = _obj.data.slice(0, _obj.size || 5);
            data.forEach((item, index) => {
                if (!item.name) {
                    item.name = '未知名称' + index;
                }

                xAxisData.push(item.name);
                seriesData.push(item)
            });

            option = {
                color: colorArray[_obj.id] || ['#2CBB79'],
                tooltip: {
                    trigger: "axis",
                    padding: 0,
                    backgroundColor: 'rgba(255,255,255,.7)',
                    formatter: function (parms) {
                        let str = "<div style='border-radius:5px;background-color: #fff;box-shadow: 0 0 10px 0 rgba(0,0,0,0.2);padding: 15px;min-width: 120px;'>" +
                            "<div style='font-size: 16px;color: #333'>" + parms[0].marker + parms[0].data.name + "</div>" +
                            "<div style='display: flex;justify-content: space-between;'><div style='color:" + parms[0].color + ";margin-right: 10px'>值：</div><div style='color:#333;'>" + parms[0].data.value + "</div></div>" +
                            "<div style='display: flex;justify-content: space-between;'><div style='color:" + parms[0].color + ";margin-right: 10px'>占比：</div><div style='color:#333;'>" + isNullObj(parms[0].data.ratio) + "</div></div></div>";
                        return str;
                    }
                },
                grid: {
                    left: '10',
                    right: '10',
                    bottom: '10',
                    top: '20',
                    containLabel: true
                },
                xAxis: {
                    type: 'category',
                    data: xAxisData,
                    axisLabel: {
                        color: '#333333',
                        // rotate: -20,  //旋转
                        textStyle: {
                            fontSize: 12
                        },
                        formatter: (v) => {
                            if (v.length > 8) {
                                v = v.substring(0, 8);
                            }
                            return v;
                        }
                    },
                    axisLine: {
                        lineStyle: {
                            type: 'dashed',
                            color: 'rgba(107,107,107,0.37)',
                        }
                    },
                    axisTick: {
                        show: false
                    },
                },
                yAxis: {
                    type: 'value',
                    axisLabel: {
                        color: '#333333',
                        textStyle: {
                            fontSize: 12
                        },
                    },
                    axisLine: {
                        lineStyle: {
                            type: 'dashed',
                            color: 'rgba(107,107,107,0.37)',
                        }
                    },
                    axisTick: {
                        show: false
                    },
                    splitLine: {
                        lineStyle: {
                            type: 'dashed',
                        }
                    }
                },
                series: [
                    {
                        data: seriesData,
                        type: 'bar',
                        barWidth: '20px',
                        label: {
                            normal: {
                                show: true,
                                fontSize: 12,
                                fontWeight: '400',
                                color: '#333',
                                position: 'top',
                            }
                        },
                        itemStyle: {
                            normal: {
                                barBorderRadius: barBorderRadius[_obj.id] || [0, 0, 0, 0],
                            }
                        }
                    }
                ]
            };
            option && myChart.setOption(option, true);
        }

        //报表模板2
        function showReportTemplate2(_obj) {
            let _elem = document.getElementById(_obj.id).querySelector('.report-itemEcharts');
            $(_elem).attr('_echarts_instance_', '');
            const myChart = echarts.init(_elem);
            let seriesData = [], xAxisData = [], option = {};
            let data = _obj.data.slice(0, _obj.size || 5);

            if (_obj.data.unit) {
                $('#' + _obj.id + ' .reportItemUnit').text("（单位：" + _obj.data.unit + "）");
            } else {
                $('#' + _obj.id + ' .reportItemUnit').text("（单位：" + _obj.parameter.param == 'qua' ? '支' : '元' + "）");
            }

            data.forEach((item, index) => {
                if (!item.name) {
                    item.name = '未知名称' + index;
                }
                xAxisData.push(item.name);
                seriesData.push(item)
            });

            option = {
                color: colorList,
                legend: {
                    icon: `path://M881.387 297.813c38.08 65.387 57.28 136.747 57.28 214.187s-19.094 148.8-57.28 214.187c-38.187 65.28-89.92 117.12-155.2 155.2S589.44 938.667 512 938.667s-148.8-19.094-214.187-57.28c-65.28-38.08-117.013-89.814-155.306-155.307C104.427 660.8 85.333 589.44 85.333 512c0-77.333 19.094-148.693 57.28-214.187 38.08-65.28 89.814-117.013 155.307-155.306C363.2 104.533 434.56 85.333 512 85.333c77.333 0 148.693 19.094 214.187 57.28 65.28 38.187 117.013 89.92 155.2 155.2z m-217.707-47.36C617.387 223.467 566.827 209.92 512 209.92s-105.387 13.547-151.68 40.533-82.987 63.68-109.973 109.974c-26.987 46.293-40.534 96.853-40.534 151.68s13.547 105.386 40.534 151.68c26.986 46.293 63.68 82.986 109.973 109.973 46.293 26.987 96.853 40.533 151.68 40.533s105.387-13.546 151.68-40.533c46.293-26.987 82.987-63.68 109.973-109.973 26.987-46.294 40.534-96.854 40.534-151.68s-13.547-105.387-40.534-151.68c-27.093-46.294-63.786-82.987-109.973-109.974z`,
                    orient: 'vertical',
                    left: '55%',
                    top: 'center',
                    align: 'left',
                    itemWidth: 14,
                    itemHeight: 14,
                    itemStyle: {
                        borderRadius: '30',
                    },
                    textStyle: {
                        color: "#333"
                    },
                    itemGap: 10,
                    formatter: function (params) {
                        let value = "", ratio = "";
                        seriesData.forEach(item => {
                            if (item.name == params) {
                                value = item.value;
                                ratio = item.ratio;
                            }

                        });
                        return [`{name|${params}}\n{value|${value}} {ratio|${isNullObj(ratio)}}`];
                    },
                    textStyle: {
                        rich: {
                            name: {
                                fontSize: 16,
                                lineHeight: 20,
                                color: '#000',
                            },
                            value: {
                                fontSize: 14,
                                lineHeight: 16,
                                color: '#333',
                                fontWeight: '500',
                                width: 80,
                                overflow: 'hidden',
                            },
                            ratio: {
                                fontSize: 14,
                                lineHeight: 16,
                                color: '#009C5E',
                                fontWeight: '500'
                            },
                        }

                    },
                },
                tooltip: {
                    trigger: 'item',
                    show: true,
                    padding: 0,
                    backgroundColor: 'rgba(255,255,255,.7)',
                    formatter: function (parms) {
                        let str = "<div style='border-radius:5px;background-color: #fff;box-shadow: 0 0 10px 0 rgba(0,0,0,0.2);padding: 15px;min-width: 120px;color: #000'>" +
                            "<div><span style='color: #2CBB79'>数值：</span><span>" + parms.data.value + "</span></div>" +
                            "<div><span style='color: #2CBB79'>占比：</span><span>" + isNullObj(parms.data.ratio) + "</span></div>" +
                            "<div><span style='color: #2CBB79'>名称：</span><span>" + parms.data.name + "</span></div></div>";
                        return str;
                    }
                },
                series: [
                    {
                        radius: ['30%', '60%'],
                        center: ['30%', '50%'],
                        type: 'pie',
                        label: {show: false},
                        data: seriesData,
                    },

                ]
            };
            option && myChart.setOption(option, true);
        }

        //报表模板3
        function showReportTemplate3(_obj) {
            let data = _obj.data.slice(0, _obj.size || 20);
            laytpl(listBox1.innerHTML).render(data, function (html) {
                document.getElementById(_obj.id).querySelector(".listBox1").innerHTML = html;
            })
        }

        //报表模板4
        function showReportTemplate4(_obj) {
            let _elem = document.getElementById(_obj.id).querySelector('.report-itemEcharts');
            $(_elem).attr('_echarts_instance_', '');
            const myChart = echarts.init(_elem);
            let seriesData = [], xAxisData = [], option = {};
            let data = _obj.data.slice(0, _obj.size || 10);
            data.forEach((item, index) => {
                if (!item.name) {
                    item.name = '未知名称' + index;
                }
                xAxisData.push(item.name);
                seriesData.push(item)
            });

            option = {
                color: colorList,
                title: {
                    text: priceUnit(_obj.totalSumOne[0].value),
                    subtext: _obj.parameter.param === 'money' ? '料号总金额' : '料号总数',
                    itemGap: 0,
                    align: 'center',
                    textAlign: 'center',
                    y: '46%',
                    x: '22%',
                    textStyle: {
                        fontSize: 24,
                        fontWeight: 'bold',
                        lineHeight: '24',
                    },
                    subtextStyle: {
                        fontSize: 12,
                        color: '#000'
                    },
                },
                legend: {
                    icon: `path://M881.387 297.813c38.08 65.387 57.28 136.747 57.28 214.187s-19.094 148.8-57.28 214.187c-38.187 65.28-89.92 117.12-155.2 155.2S589.44 938.667 512 938.667s-148.8-19.094-214.187-57.28c-65.28-38.08-117.013-89.814-155.306-155.307C104.427 660.8 85.333 589.44 85.333 512c0-77.333 19.094-148.693 57.28-214.187 38.08-65.28 89.814-117.013 155.307-155.306C363.2 104.533 434.56 85.333 512 85.333c77.333 0 148.693 19.094 214.187 57.28 65.28 38.187 117.013 89.92 155.2 155.2z m-217.707-47.36C617.387 223.467 566.827 209.92 512 209.92s-105.387 13.547-151.68 40.533-82.987 63.68-109.973 109.974c-26.987 46.293-40.534 96.853-40.534 151.68s13.547 105.386 40.534 151.68c26.986 46.293 63.68 82.986 109.973 109.973 46.293 26.987 96.853 40.533 151.68 40.533s105.387-13.546 151.68-40.533c46.293-26.987 82.987-63.68 109.973-109.973 26.987-46.294 40.534-96.854 40.534-151.68s-13.547-105.387-40.534-151.68c-27.093-46.294-63.786-82.987-109.973-109.974z`,
                    orient: 'vertical',
                    left: '50%',
                    top: 'center',
                    align: 'left',
                    itemWidth: 14,
                    itemHeight: 14,
                    itemStyle: {
                        borderRadius: '30',
                    },
                    textStyle: {
                        color: "#333"
                    },
                    itemGap: 18,
                    formatter: function (params) {
                        let value = "", ratio = "";
                        seriesData.forEach(item => {
                            if (item.name == params) {
                                value = item.value;
                                ratio = item.ratio;
                            }

                        });
                        return [`{name|${params.substring(0, 10)}}{value|${isNullObj(value)}} {ratio|${isNullObj(ratio, '%')}}`];
                    },
                    textStyle: {
                        rich: {
                            name: {
                                fontSize: 14,
                                lineHeight: 20,
                                color: '#000',
                                width: 100,
                            },
                            value: {
                                fontSize: 14,
                                lineHeight: 16,
                                color: '#333',
                                fontWeight: '500',
                                width: 80,
                                overflow: 'hidden',
                            },
                            ratio: {
                                fontSize: 14,
                                lineHeight: 16,
                                color: '#009C5E',
                                fontWeight: '500'
                            },
                        }

                    },
                },
                tooltip: {
                    trigger: 'item',
                    show: true,
                    padding: 0,
                    backgroundColor: 'rgba(255,255,255,.7)',
                    formatter: function (parms) {
                        let str = "<div style='border-radius:5px;background-color: #fff;box-shadow: 0 0 10px 0 rgba(0,0,0,0.2);padding: 15px;min-width: 120px;color: #2CBB79'>" +
                            "<div>数值：" + parms.data.value + "</div>" +
                            "<div>占比：" + isNullObj(parms.data.ratio) + "</div>" +
                            "<div>名称：" + parms.data.name + "</div></div>";
                        return str;
                    }
                },
                series: [
                    {
                        radius: ['40%', '68%'],
                        center: ['23%', '50%'],
                        type: 'pie',
                        label: {show: false},
                        data: seriesData,
                    },
                    {
                        color: 'rgba(250,250,250,0.5)',
                        radius: ['63%', '70%'],
                        center: ['23%', '50%'],
                        label: {show: false},
                        type: 'pie',
                        data: [{value: 1}],
                        tooltip: {
                            show: false
                        }
                    }
                ]
            };
            option && myChart.setOption(option, true);
        }

        //报表模板5
        function showReportTemplate5(_obj) {
            let _elem = document.getElementById(_obj.id).querySelector('.report-itemEcharts');
            $(_elem).attr('_echarts_instance_', '');
            const myChart = echarts.init(_elem);
            let seriesData = [], xAxisData = [], option = {};
            let data = _obj.data.slice(0, _obj.size || 5);

            if (_obj.data.unit) {
                $('#' + _obj.id + ' .reportItemUnit').text("（单位：" + _obj.data.unit + "）");
            } else {
                $('#' + _obj.id + ' .reportItemUnit').text("（单位：" + _obj.parameter.param == 'qua' ? '支' : '元' + "）");
            }

            data.forEach((item, index) => {
                if (!item.name) {
                    item.name = '未知名称' + index;
                }
                xAxisData.push(item.name);
                seriesData.push(item)
            });

            option = {
                color: colorList,
                legend: {
                    // icon: `path://M881.387 297.813c38.08 65.387 57.28 136.747 57.28 214.187s-19.094 148.8-57.28 214.187c-38.187 65.28-89.92 117.12-155.2 155.2S589.44 938.667 512 938.667s-148.8-19.094-214.187-57.28c-65.28-38.08-117.013-89.814-155.306-155.307C104.427 660.8 85.333 589.44 85.333 512c0-77.333 19.094-148.693 57.28-214.187 38.08-65.28 89.814-117.013 155.307-155.306C363.2 104.533 434.56 85.333 512 85.333c77.333 0 148.693 19.094 214.187 57.28 65.28 38.187 117.013 89.92 155.2 155.2z m-217.707-47.36C617.387 223.467 566.827 209.92 512 209.92s-105.387 13.547-151.68 40.533-82.987 63.68-109.973 109.974c-26.987 46.293-40.534 96.853-40.534 151.68s13.547 105.386 40.534 151.68c26.986 46.293 63.68 82.986 109.973 109.973 46.293 26.987 96.853 40.533 151.68 40.533s105.387-13.546 151.68-40.533c46.293-26.987 82.987-63.68 109.973-109.973 26.987-46.294 40.534-96.854 40.534-151.68s-13.547-105.387-40.534-151.68c-27.093-46.294-63.786-82.987-109.973-109.974z`,
                    orient: 'vertical',
                    right: '5%',
                    top: 'center',
                    align: 'left',
                    itemWidth: 14,
                    itemHeight: 14,
                    // itemStyle: {
                    //     borderRadius: '30',
                    // },
                    textStyle: {
                        color: "#333"
                    },
                    itemGap: 15,
                    formatter: function (params) {
                        let value = "", ratio = "";
                        seriesData.forEach(item => {
                            if (item.name == params) {
                                value = item.value;
                                ratio = item.ratio;
                            }

                        });
                        return [`{name|${params}}\n{value|${value}} {ratio|${isNullObj(ratio)}}`];
                    },
                    textStyle: {
                        rich: {
                            name: {
                                fontSize: 16,
                                lineHeight: 20,
                                color: '#000',
                            },
                            value: {
                                fontSize: 14,
                                lineHeight: 16,
                                color: '#333',
                                fontWeight: '500',
                                width: 80,
                                overflow: 'hidden',
                            },
                            ratio: {
                                fontSize: 14,
                                lineHeight: 16,
                                color: '#009C5E',
                                fontWeight: '500'
                            },
                        }

                    },
                },
                tooltip: {
                    trigger: 'item',
                    show: true,
                    padding: 0,
                    backgroundColor: 'rgba(255,255,255,.7)',
                    formatter: function (parms) {
                        let str = "<div style='border-radius:5px;background-color: #fff;box-shadow: 0 0 10px 0 rgba(0,0,0,0.2);padding: 15px;min-width: 120px;color: #000'>" +
                            "<div><span style='color: #2CBB79'>数值：</span><span>" + parms.data.value + "</span></div>" +
                            "<div><span style='color: #2CBB79'>占比：</span><span>" + isNullObj(parms.data.ratio) + "</span></div>" +
                            "<div><span style='color: #2CBB79'>名称：</span><span>" + parms.data.name + "</span></div></div>";
                        return str;
                    }
                },
                series: [
                    {
                        radius: ['30%', '60%'],
                        center: ['30%', '50%'],
                        type: 'pie',
                        label: {
                            normal: {
                                formatter: function (params) {
                                    return '{ratio|' + params.data.ratio + '}';
                                },
                                rich: {
                                    ratio: {
                                        color: "#333",
                                        align: 'center',
                                        fontSize: 12
                                    }
                                }
                            },
                        },
                        data: seriesData,
                    },

                ]
            };
            option && myChart.setOption(option, true);
        }

        //报表模板6
        function showReportTemplate6(_obj) {
            let _elem = document.getElementById(_obj.id).querySelector('.report-itemEcharts');
            $(_elem).attr('_echarts_instance_', '');
            const myChart = echarts.init(_elem), nameList = ['暂存', '报修', '报废', '规格不相符', '缺失'],
                colorList = ['#2977FF', '#FFBC37', '#F77234', '#AC31E4', '#CCCCCC'];

            let stagingSeriesData = [], //暂存
                repairSeriesData = [], //报修
                scrapSeriesData = [], //报废
                specsSeriesData = [], //规格不相符
                lackSeriesData = [], //缺失
                xAxisData = [],
                option = {};
            let data = _obj.data.slice(0, _obj.size || 5);

            data.forEach((item, index) => {
                if (!item.name) {
                    item.name = '未知名称' + index;
                }

                xAxisData.push(item.name);
                if (item.temp) {
                    stagingSeriesData.push({value: item.temp, ratio: item.tempRatio})
                }
                if (item.repair) {
                    repairSeriesData.push({value: item.repair, ratio: item.repairRatio})
                }

                if (item.recycle) {
                    scrapSeriesData.push({value: item.recycle, ratio: item.recycleRatio})
                }

                if (item.specNot) {
                    specsSeriesData.push({value: item.specNot, ratio: item.specNotRatio})
                }

                if (item.loss) {
                    lackSeriesData.push({value: item.loss, ratio: item.lossRatio})
                }

            });

            option = {
                color: colorList,
                tooltip: {
                    trigger: "axis",
                    padding: 0,
                    backgroundColor: 'rgba(255,255,255,.7)',
                    formatter: function (parms) {
                        let itemList = '';
                        parms.reverse().forEach((item, index) => {
                            itemList += `
                                <div style='display: flex;justify-content: space-between;line-height: 1.8em;'>
                                    <div style='color:${parms[index].color};margin-right: 10px'>${parms[index].seriesName}</div>
                                    <div style='color:${parms[index].color};'>${parms[index].value} (${parms[index].data.ratio})</div>
                                </div>
                            `
                        });
                        let str = "<div style='border-radius:5px;background-color: rgba(255,255,255,0.7);box-shadow: 0 0 10px 0 rgba(0,0,0,0.2);padding: 15px;min-width: 120px;'>" +
                            "<div style='font-size: 16px;color: #333'>" + parms[0].name + "</div>" + itemList + "</div>";
                        return str;
                    }
                },
                legend: {
                    icon: 'rect',
                    left: "5%",
                    data: nameList,
                    itemWidth: 20,
                    itemHeight: 3,
                    itemGap: 30,
                },
                grid: {
                    left: '10',
                    right: '10',
                    bottom: '10',
                    top: '50',
                    containLabel: true
                },
                xAxis: {
                    type: 'category',
                    data: xAxisData,
                    axisLabel: {
                        color: '#333333',
                        textStyle: {
                            fontSize: 12
                        },
                        formatter: (v) => {
                            if (v.length > 8) {
                                v = v.substring(0, 8);
                            }
                            return v;
                        }
                    },
                    axisLine: {
                        lineStyle: {
                            type: 'dashed',
                            color: 'rgba(107,107,107,0.37)',
                        }
                    },
                    axisTick: {
                        show: false
                    },
                },
                yAxis: {
                    type: 'value',
                    axisLabel: {
                        color: '#333333',
                        textStyle: {
                            fontSize: 12
                        },
                    },
                    axisLine: {
                        lineStyle: {
                            type: 'dashed',
                            color: 'rgba(107,107,107,0.37)',
                        }
                    },
                    axisTick: {
                        show: false
                    },
                    splitLine: {
                        lineStyle: {
                            type: 'dashed',
                        }
                    }
                },
                series: [
                    {
                        data: stagingSeriesData,
                        type: 'bar',
                        name: '暂存',
                        stack: '1',
                        barWidth: '20px',
                    },
                    {
                        data: repairSeriesData,
                        type: 'bar',
                        name: '报修',
                        barWidth: '20px',
                        stack: '1',
                    },
                    {
                        data: scrapSeriesData,
                        type: 'bar',
                        name: '报废',
                        barWidth: '20px',
                        stack: '1',
                    },
                    {
                        data: specsSeriesData,
                        type: 'bar',
                        name: '规格不相符',
                        barWidth: '20px',
                        stack: '1',
                    },
                    {
                        data: lackSeriesData,
                        type: 'bar',
                        name: '缺失',
                        barWidth: '20px',
                        stack: '1',
                    }
                ]
            };
            option && myChart.setOption(option, true);
        }

        //报表模板7
        function showReportTemplate7(_obj, _type) {
            let type = _type || '';
            let _elem = document.getElementById(_obj.id).querySelector('.report-itemEcharts1');
            let newData = _obj.data;
            if (type == 2) {
                _elem = document.getElementById(_obj.id).querySelector('.report-itemEcharts2');
                newData = _obj.data2;
            } else if (type == 3) {
                _elem = document.getElementById(_obj.id).querySelector('.report-itemEcharts3');
                newData = _obj.data3;
            } else {
                _elem = document.getElementById(_obj.id).querySelector('.report-itemEcharts1');
                newData = _obj.data;
            }

            $(_elem).attr('_echarts_instance_', '');
            const myChart = echarts.init(_elem);

            let seriesData = [], xAxisData = [], option = {},
                colorList = ['#2CBB79', '#2F75FB', '#F77234', '#AC31E4', '#CCCCCC', '#009C5E'];
            let data = newData.slice(0, _obj.size || 10);

            data.forEach((item, index) => {
                if (!item.name) {
                    item.name = '未知名称' + index;
                }
                // xAxisData.push(item.name);
                seriesData.push(item);
            });

            option = {
                color: colorList,
                title: {
                    text: priceUnit(_obj['totalSum' + type].value),
                    subtext: _obj['subTitle' + type],
                    itemGap: 0,
                    align: 'center',
                    textAlign: 'center',
                    y: '46%',
                    x: '29%',
                    textStyle: {
                        fontSize: 24,
                        fontWeight: 'bold',
                        lineHeight: '24',
                    },
                    subtextStyle: {
                        fontSize: 12,
                        color: '#000'
                    },
                },
                legend: {
                    icon: `path://M881.387 297.813c38.08 65.387 57.28 136.747 57.28 214.187s-19.094 148.8-57.28 214.187c-38.187 65.28-89.92 117.12-155.2 155.2S589.44 938.667 512 938.667s-148.8-19.094-214.187-57.28c-65.28-38.08-117.013-89.814-155.306-155.307C104.427 660.8 85.333 589.44 85.333 512c0-77.333 19.094-148.693 57.28-214.187 38.08-65.28 89.814-117.013 155.307-155.306C363.2 104.533 434.56 85.333 512 85.333c77.333 0 148.693 19.094 214.187 57.28 65.28 38.187 117.013 89.92 155.2 155.2z m-217.707-47.36C617.387 223.467 566.827 209.92 512 209.92s-105.387 13.547-151.68 40.533-82.987 63.68-109.973 109.974c-26.987 46.293-40.534 96.853-40.534 151.68s13.547 105.386 40.534 151.68c26.986 46.293 63.68 82.986 109.973 109.973 46.293 26.987 96.853 40.533 151.68 40.533s105.387-13.546 151.68-40.533c46.293-26.987 82.987-63.68 109.973-109.973 26.987-46.294 40.534-96.854 40.534-151.68s-13.547-105.387-40.534-151.68c-27.093-46.294-63.786-82.987-109.973-109.974z`,
                    orient: 'vertical',
                    right: '1%',
                    top: 'center',
                    align: 'left',
                    itemWidth: 14,
                    itemHeight: 14,
                    data: seriesData,
                    itemStyle: {
                        borderRadius: '30',
                    },
                    textStyle: {
                        color: "#333"
                    },
                    itemGap: 15,
                    formatter: function (params) {
                        let obj = {};
                        option.series[0].data.forEach(item => {
                            if (params == item.name) {
                                obj[params] = {};
                                obj[params].value = item.value;
                                obj[params].ratio = item.ratio;
                                obj[params].name = item.name;
                            }
                        });
                        return [`{name|${obj[params].name.substring(0, 10)}} \n {value|${isNullObj(obj[params].value)}} {ratio|${isNullObj(obj[params].ratio, '%')}}`];
                    },
                    textStyle: {
                        rich: {
                            name: {
                                fontSize: 14,
                                lineHeight: 25,
                                color: '#000',
                                width: 100,
                            },
                            value: {
                                fontSize: 14,
                                lineHeight: 16,
                                color: '#333',
                                fontWeight: '500',
                                width: 80,
                                overflow: 'hidden',
                            },
                            ratio: {
                                fontSize: 14,
                                lineHeight: 16,
                                color: '#009C5E',
                                width: 80,
                                overflow: 'hidden',
                            },
                        }

                    },
                },
                tooltip: {
                    trigger: 'item',
                    show: true,
                    padding: 0,
                    backgroundColor: 'rgba(255,255,255,.7)',
                    formatter: function (parms) {
                        let str = "<div style='border-radius:5px;background-color: #fff;box-shadow: 0 0 10px 0 rgba(0,0,0,0.2);padding: 15px;min-width: 120px;color: #2CBB79'>" +
                            "<div>数值：" + parms.data.value + "</div>" +
                            "<div>占比：" + isNullObj(parms.data.ratio) + "</div>" +
                            "<div>名称：" + parms.data.name + "</div></div>";
                        return str;
                    }
                },
                series: [
                    {
                        radius: ['40%', '68%'],
                        center: ['30%', '50%'],
                        type: 'pie',
                        label: {show: false},
                        data: seriesData,
                    },
                    {
                        color: 'rgba(250,250,250,0.5)',
                        radius: ['63%', '70%'],
                        center: ['30%', '50%'],
                        label: {show: false},
                        type: 'pie',
                        data: [{value: 1}],
                        tooltip: {
                            show: false
                        }
                    },
                ]
            };
            option && myChart.setOption(option, true);
        }

        //table表
        function showTable(_obj) {
            if (!_obj.tableShow) {
                return false
            }
            let insTb = table.render({
                elem: '#' + _obj.table.id,
                url: config.base + _obj.table.url,
                where: headerTime,
                page: true,
                cellMinWidth: 100,
                id: 'getNewReportTable',
                cols: [_obj.table.cols],
                done: function (d) {
                }
            });
        }


        // 所有报表点击更多事件
        $('#reportBody .report-item-more').click(function () {
            if (activeConfigData.reportMain[$(this).parents('.report-main-item').attr('id')].data.length === 0) {
                layer.msg('暂时没有数据~~~', {icon: 5});
                return false;
            }
            showAllDataChart(activeConfigData.reportMain[$(this).parents('.report-main-item').attr('id')])
        });

        // 所有报表点击更多事件
        $('#overviewStatisticsDay .report-item-more').click(function () {
            if (activeConfigData.reportTopShow) {
                showAllDataChart(activeConfigData.reportTop)
            }
        });

        // 更多弹窗
        function showAllDataChart(_data) {
            admin.open({
                type: 1,
                area: ['1400px', '700px'],
                offset: '65px',
                title: _data.title,
                content: $('#allDataChart').html(),
                success: function () {
                    const myChart = echarts.init(document.getElementById('allDataChartFormchartDom'));
                    let seriesData = [], seriesData1 = [], seriesData2 = [], seriesData3 = [], yAxisData = [], option,
                        dataZoomObj = '',
                        seriesObjData = [], tooltipObj = {}, colors = ['#01B780'];
                    let stagingSeriesData = [], //暂存
                        repairSeriesData = [], //报修
                        scrapSeriesData = [], //报废
                        specsSeriesData = [], //规格不相符
                        lackSeriesData = []; //缺失
                    let colsData = [{field: 'name', title: '名称'}];
                    let data = _data.sort ? [..._data.data].reverse() : [..._data.data];
                    data.forEach(item => {
                        yAxisData.push(item.name);
                        seriesData.push(item);
                        if (item.value1) {
                            seriesData1.push(item.value1)
                        }
                        if (item.value2) {
                            seriesData2.push(item.value2)
                        }
                        if (item.temp) {
                            seriesData3.push(item);
                            if (item.temp) {
                                stagingSeriesData.push({value: item.temp, ratio: item.tempRatio})
                            }
                            if (item.repair) {
                                repairSeriesData.push({value: item.repair, ratio: item.repairRatio})
                            }

                            if (item.recycle) {
                                scrapSeriesData.push({value: item.recycle, ratio: item.recycleRatio})
                            }

                            if (item.specNot) {
                                specsSeriesData.push({value: item.specNot, ratio: item.specNotRatio})
                            }

                            if (item.loss) {
                                lackSeriesData.push({value: item.loss, ratio: item.lossRatio})
                            }
                        }
                    });
                    if (data[0].ratio) {
                        colsData.push({field: 'ratio', title: '占比'})
                    }

                    if (seriesData2.length > 0) {
                        colsData.push(
                            {field: 'value', title: '暂存'},
                            {field: 'value1', title: '报修'},
                            {field: 'value2', title: '报废'}
                        );
                        seriesObjData.push(
                            {name: '报废', type: 'bar', barWidth: '15', stack: '2', data: seriesData2},
                            {name: '报修', type: 'bar', barWidth: '15', stack: '2', data: seriesData1},
                            {name: '暂存', type: 'bar', barWidth: '15', stack: '2', data: seriesData},
                        );
                        tooltipObj = {
                            trigger: "axis",
                            padding: 0,
                            backgroundColor: 'rgba(255,255,255,.7)',
                            formatter: function (parms) {
                                let htmlStr = '', str = '';
                                parms.reverse().forEach(item => {
                                    htmlStr += `<div style='display: flex;font-size: 12px;color: #333;justify-content: space-between;'>
                                           <div style="margin-right: 30px">${item.marker}${item.seriesName}</div>
                                           <div>${item.value}</div>
                                       </div>`
                                });
                                str = "<div style='border-radius:5px;background-color: #fff;box-shadow: 0 0 10px 0 rgba(0,0,0,0.2);padding: 15px;min-width: 120px;'>" +
                                    "<div style='font-size: 14px;font-weight: 400;color: #666'>" + parms[0].name + "</div>" + htmlStr + "</div>";
                                return str;
                            }
                        };
                        colors = ['#FFB94D', '#F77234', '#2CBB79'];
                    } else if (seriesData1.length > 0) {
                        colsData.push({field: 'value', title: '数量(包装计)'}, {field: 'value1', title: '数量(基础单位计)'});
                        seriesObjData.push(
                            {name: '数量(包装计)', type: 'bar', barWidth: '15', stack: '2', data: seriesData},
                            {name: '数量(基础单位计)', type: 'bar', barWidth: '15', stack: '2', data: seriesData1}
                        );
                        tooltipObj = {
                            trigger: "axis",
                            padding: 0,
                            backgroundColor: 'rgba(255,255,255,.7)',
                            formatter: function (parms) {
                                let htmlStr = '', str = '';
                                parms.forEach(item => {
                                    htmlStr += `<div style='display: flex;font-size: 12px;color: #333;justify-content: space-between;'>
                                           <div style="margin-right: 30px">${item.marker}${item.seriesName}</div>
                                           <div>${item.value}</div>
                                       </div>`
                                });
                                str = "<div style='border-radius:5px;background-color: #fff;box-shadow: 0 0 10px 0 rgba(0,0,0,0.2);padding: 15px;min-width: 120px;'>" +
                                    "<div style='font-size: 14px;font-weight: 400;color: #666'>" + parms[0].name + "</div>" + htmlStr + "</div>";
                                return str;
                            }
                        };
                        colors = ['#2CBB79', '#FFB94D'];
                    }else if (seriesData3.length > 0){
                        colsData.push(
                            {field: 'temp', title: '暂存'},
                            {field: 'tempRatio', title: '暂存占比'},
                            {field: 'repair', title: '报修'},
                            {field: 'repairRatio', title: '报修占比'},
                            {field: 'repair', title: '报废'},
                            {field: 'repairRatio', title: '报废占比'},
                            {field: 'specNot', title: '规格不相符'},
                            {field: 'specNotRatio', title: '规格不相符占比'},
                            {field: 'loss', title: '缺失'},
                            {field: 'lossRatio', title: '缺失占比'},
                            {field: 'sumVal', title: '总计'},
                        );
                        colors = ['#2977FF', '#FFBC37', '#F77234', '#AC31E4', '#CCCCCC'];
                        seriesObjData.push(
                            {name: '暂存', type: 'bar', barWidth: '15', stack: '2', data: stagingSeriesData},
                            {name: '报修', type: 'bar', barWidth: '15', stack: '2', data: repairSeriesData},
                            {name: '报废', type: 'bar', barWidth: '15', stack: '2', data: scrapSeriesData},
                            {name: '规格不相符', type: 'bar', barWidth: '15', stack: '2', data: specsSeriesData},
                            {name: '缺失', type: 'bar', barWidth: '15', stack: '2', data: lackSeriesData},
                        );
                        tooltipObj = {
                            trigger: "axis",
                            padding: 0,
                            backgroundColor: 'rgba(255,255,255,.7)',
                            formatter: function (parms) {
                                let itemList = '';
                                parms.reverse().forEach((item, index) => {
                                    itemList += `
                                <div style='display: flex;justify-content: space-between;line-height: 1.8em;'>
                                    <div style='color:${parms[index].color};margin-right: 10px'>${parms[index].seriesName}</div>
                                    <div style='color:${parms[index].color};'>${parms[index].value} (${parms[index].data.ratio})</div>
                                </div>
                            `
                                });
                                let str = "<div style='border-radius:5px;background-color: rgba(255,255,255,0.7);box-shadow: 0 0 10px 0 rgba(0,0,0,0.2);padding: 15px;min-width: 120px;'>" +
                                    "<div style='font-size: 16px;color: #333'>" + parms[0].name + "</div>" + itemList + "</div>";
                                return str;
                            }
                        };


                    } else {
                        colsData.push({field: 'value', title: '数值'});
                        seriesObjData.push(
                            {name: _data.data.title, type: 'bar', barWidth: '15', data: seriesData}
                        );
                        tooltipObj = {
                            trigger: "axis",
                            padding: 0,
                            backgroundColor: 'rgba(255,255,255,.7)',
                            formatter: function (parms) {
                                let str = '', code = '';
                                if (parms[0].data.oldSpecCode) {
                                    code = "<div>规格：" + parms[0].data.oldSpecCode + "</div>"
                                } else {
                                    code = ""
                                }

                                str = "<div style='border-radius:5px;background-color: #fff;box-shadow: 0 0 10px 0 rgba(0,0,0,0.2);padding: 15px;min-width: 120px;color: #2CBB79'>" +
                                    "<div>数值：" + parms[0].data.value + "</div>" +
                                    "<div>占比：" + isNullObj(parms[0].data.ratio) + "</div>" + code +
                                    "<div>名称：" + parms[0].data.name + "</div></div>";
                                return str;
                            }
                        };
                        colors = ['#01B780'];
                    }

                    if (data[0].oldSpecCode) {
                        colsData.push({field: 'oldSpecCode', title: '物料规格'})
                    }


                    if (seriesData.length > 10) {
                        dataZoomObj = {
                            type: 'slider',
                            startValue: 1,
                            endValue: 10,
                            show: true,
                            right: 0,
                            width: 20,
                            start: 100 - (10 / seriesData.length) * 100,
                            end: 100,
                            yAxisIndex: 0,
                            handleStyle: {color: "#009C5E"},
                            textStyle: {color: "#000"},
                            fillerColor: "rgb(0,181,89,0.3)",
                            borderColor: "rgb(0,181,89,0.3)",
                        }
                    } else {
                        dataZoomObj = ''
                    }

                    option = {
                        color: colors,
                        tooltip: tooltipObj,
                        grid: {
                            left: '30',
                            right: '2%',
                            bottom: '0%',
                            containLabel: true
                        },
                        xAxis: {
                            type: 'value',
                            axisLabel: {
                                color: '#333333',
                                textStyle: {
                                    fontSize: 12
                                },
                            },
                            axisLine: {
                                lineStyle: {
                                    type: 'dashed',
                                    color: 'rgba(107,107,107,0.37)',
                                }
                            },
                            axisTick: {
                                show: false
                            },
                        },
                        yAxis: {
                            type: 'category',
                            data: yAxisData,
                            axisLabel: {
                                color: '#333333',
                                textStyle: {
                                    fontSize: 12
                                },
                                formatter: (v) => {
                                    if (v.length > 10) {
                                        v = v.substring(0, 10) + '...';
                                    }
                                    return v;
                                }
                            },
                            axisLine: {
                                lineStyle: {
                                    type: 'dashed',
                                    color: 'rgba(107,107,107,0.37)',
                                }
                            },
                            axisTick: {
                                show: false
                            },
                        },
                        dataZoom: dataZoomObj,
                        series: seriesObjData
                    };

                    option && myChart.setOption(option, true);


                    let allDataChartTb = table.render({
                        elem: '#allDataChartTable',
                        data: data,
                        cellMinWidth: 100,
                        page: false,
                        cols: [colsData],
                    });

                    if (data.length === 0) {
                        $('#allDataChartFormExport').remove();
                    } else {
                        $('#allDataChartFormExport').click(function () {
                            table.exportFile(allDataChartTb.config.id, [...data].reverse(), 'xls', _data.name|| _data.title)
                        })
                    }

                }
            });

        }

        //归还人
        admin.req('user/admin/user/getAll', {limit: 9999}, res => {
            if (res.code == 200) {
                loadReportSelectHtml(res.data, '请选择归还人', 'creator', 3, '#causeStatistics')
            } else {
                loadReportSelectHtml([], '请选择归还人', 'creator', 3, '#causeStatistics')
            }
        });

        // 渲染下拉框
        function loadReportSelectHtml(data, tips, htmltarget, type, parentName) {
            let html = ' <option value="">' + tips + '</option>';
            if (!data || data == null) {
                return;
            }
            for (let i = 0; i < data.length; i++) {
                if (type == 1) {
                    html += `<option value='${data[i].name}'>${data[i].name}</option>`;
                } else if (type == 2) {
                    html += `<option value='${data[i].cabCode}'>${data[i].cabCode}</option>`;
                }else if (type == 3) {
                    html += `<option value='${data[i].id}'>${data[i].nickname}|${data[i].username}</option>`;
                }else{
                    html += `<option value='${data[i].id}'>${data[i].name}</option>`;
                }
            }
            $(parentName).find("select[name='" + htmltarget + "']").html(html);
            form.render('select');
        }

        // 图片点击放大
        $("body").delegate(".checkImg", "click", function () {
            admin.previewImg(this)
        });

        // 判断是否是 空{}
        function isNullObj(_data) {
            if (_data) {
                if (JSON.stringify(_data) == "{}") {
                    return '0%'
                } else {
                    return _data
                }
            }
            return '0%';
        }

        //单位转换
        function priceUnit(num) {
            let unit = ['', '万', '亿', '万亿'];
            let k = 10000, i;
            if (num < k) {
                return num
            } else {
                i = Math.floor(Math.log(num) / Math.log(k));
                return (num / Math.pow(k, i)).toFixed(2) + unit[i]
            }
        }

        //长度限制
        function limitLength(str, length) {
            // 如果字符串的长度小于等于限制的长度，则直接返回原字符串
            if (str.length <= length) {
                return str;
            }
            // 否则，只取前面限制长度的部分字符串，并在结尾加上省略号
            return str.slice(0, length) + '...';
        }

        // 获取月份的天数
        function getMonthDays(year, month) {
            let targetDate = new Date(year, month, 0); // 目标月份的最后一天
            let totalDays = targetDate.getDate(); // 获取目标月份的天数
            return totalDays;
        }
    });
</script>
